Gadgets don't connect to style-changed for widget nodes, and
GtkImage uses its widget node for the icon helper. The visible
effect of this is that symbolic icons don't change color when
switching to the dark variant of Adwaita.
Fix this by manually invalidating the icon helper.
G_DEFINE_TYPE_WITH_PRIVATE (GtkIconHelper, gtk_icon_helper, GTK_TYPE_CSS_GADGET)
-static void
+void
gtk_icon_helper_invalidate (GtkIconHelper *self)
{
if (self->priv->rendered_surface != NULL)
void _gtk_icon_helper_set_force_scale_pixbuf (GtkIconHelper *self,
gboolean force_scale);
+void gtk_icon_helper_invalidate (GtkIconHelper *self);
G_END_DECLS
{
GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = image->priv;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+ if (context)
+ {
+ GtkCssStyleChange *change = gtk_style_context_get_change (context);
+
+ if (change && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON))
+ gtk_icon_helper_invalidate (priv->icon_helper);
+ }
GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget);